//@ts-expect-error mock模拟数据
import Mock from "mockjs"

const distData: any = {
  gender: ["男", "女"],
  age: ["18-23", "24-30", "31-40", "41-50", "50+"],
  dsp_status: ["投放中", "已停投", "待投放"],
  dsp_target: ["销售转化", "流量获取", "注册用户"],
}

//用户信息数据
const dict_mock = (response: any) => {
  // // 获取请求头携带token
  const { type } = JSON.parse(response.body)
  if (!type) {
    return { code: 201, data: { msg: "获取失败" } }
  }
  return {
    code: 0,
    msg: "获取成功",
    type,
    list: distData[type],
    data: (distData[type] || []).map((item: string, index: number) => ({
      value: index + 1,
      label: item,
    })),
  }
}

Mock.mock("/api/mock/dict", "post", dict_mock)
